package cn.ymatou.paymentproxy.admin.api.service;

import org.json.JSONException;
import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*添加直播商品接口Call
*FreeMaker Template自动生成代码
*/
public class PaymentQueryCall extends YmatouBaseCall{
	private static String opurl ="api/paymentquery/";
//	public PaymentQueryCall() {
//		super(EnvSetup.getSystemUrl("PaymentQuery"),opurl,"GET","PARAM");
//	}
	 public PaymentQueryCall(String paytype) {
	        super(EnvSetup.getSystemUrl("PaymentQuery"), opurl + paytype, "GET", "PARAM");
	    }
	
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	/**
	 * 获取Data
	 * 
	 * @return
	 */
	public JSONObject getData() {
		JSONObject Data = null;
		try {
			Data = new JSONObject(getReturnData().substring(1, getReturnData().length()-1)).getJSONObject("Data");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Data;
	}

	/**
	 * 获取补款ID
	 * 
	 * @return
	 */
	public String getInstitutePaymentId() {
		String InstitutePaymentId = null;
		try {
			InstitutePaymentId = getData().getString("InstitutePaymentId");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return InstitutePaymentId;
	}
}